package com.yzyz.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.yzyz.bean.scenic.AttractionsBean;
import com.yzyz.dao.AttractionsDao;
import com.yzyz.service.AttractionsService;
import com.yzyz.utils.error.Error;

/**
 * 
 * @author David Sun
 * @Date   2010-4-5
 *
 */
@Transactional
public class AttractionsServiceImpl implements AttractionsService {
	private AttractionsDao attractionsDao;
	@Override
	public List<AttractionsBean> paginagte(int scenicId, int start, int limit) {
		
		return this.attractionsDao.paginate(scenicId, start, limit);
	}

	@Override
	public int add(Object object) {
		this.attractionsDao.save(object);
		return Error.SUCCESS;
	}

	@Override
	public int delete(int id) {
		this.attractionsDao.delete(id);
		return Error.SUCCESS;
	}

	@Override
	public Object find(int id) {
		return this.attractionsDao.get(id);
	}
	@Transactional(propagation = Propagation.REQUIRED,rollbackFor=Exception.class)
	@Override
	public int update(Object object) {
		this.attractionsDao.update(object);
		return Error.SUCCESS;
	}

	@Override
	public void setAttractionsDao(AttractionsDao attractionsDao) {
		this.attractionsDao = attractionsDao;
		
	}

	@Override
	public int getCount(int scenicId) {
		return this.attractionsDao.getCount(scenicId);
	}

	@Override
	public List<?> paginate(int start, int limit) {
		// TODO Auto-generated method stub
		return null;
	}

}
